﻿#include <QObject>
#include <QTcpSocket>
#include <QTimer>
#include <boost/asio.hpp>

using boost::asio::ip::tcp;

class TcpClient : public QObject {
    Q_OBJECT
public:
    TcpClient(QObject* parent = nullptr);

public slots:
    void SendHeartbeat();
    void ConnectToServer(const QString& host, quint16 port);
    void DisconnectFromServer();
    void StartReading();
    void sendData(const QString& data);

private:
    boost::asio::io_context asio_context;
    tcp::socket socket;
    boost::asio::streambuf receive_buf;
    QTimer* timer;
};
